package com.fzhucc.modules.businessCard.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.fzhucc.modules.system.domain.User;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
* @description /
* @author yyg
* @date 2022-10-24
**/
@Entity
@Data
@Table(name="tb_business_card_status")
public class BusinessCardStatus implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "user_id")
    @ApiModelProperty(value = "用户ID")
    private Long userId;

    @ManyToOne
    @JoinColumn(name = "user_id", updatable = false, insertable = false)
    private User user;

    @Column(name = "`business_card_id`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "收藏的名片id")
    private Integer businessCardId;

    @Column(name = "`is_collect`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "是否收藏")
    private Integer isCollect;

    public void copy(BusinessCardStatus source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
